<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title>TRANS-INFO</title>
		<meta name="keywords" content="TRANS-INFO">
		<meta name="description" content="TRANS-INFO">

		<link href="../css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
		<link href="../css/font-awesome.css?v=4.4.0" rel="stylesheet">
		<link href="../css/animate.css" rel="stylesheet">
		<link href="../css/style.css?v=4.1.0" rel="stylesheet">

		<!-- treegrid -->
		<link href="../css/plugins/treeview/bootstrap-treeview.css" rel="stylesheet">

	</head>

	<body class="gray-bg">
		<div class="wrapper wrapper-content animated fadeInRight">

			

			<div class="row">
				<div class="col-sm-12" >
					<div class="ibox float-e-margins" >
						<div class="ibox-title">
							<h5>
							<i class="fa fa-table"></i> 方法级调用链明细
						</h5>
							<div class="ibox-tools">
								<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
								</a>
								<a class="dropdown-toggle" data-toggle="dropdown" href="trans_info.html"> <i class="fa fa-wrench"></i>
								</a>
								<ul class="dropdown-menu dropdown-user">
									<li>
										<a href="trans_info.html">选项1</a>
									</li>
									<li>
										<a href="trans_info.html">选项2</a>
									</li>
								</ul>

							</div>
						</div>
						<div class="ibox-content">
							<div id="trans_detail"  class="test" style="overflow-x: auto;overflow-y: auto;height: 550px;" ></div>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-sm-12">
					<div class="ibox float-e-margins">
						<div class="ibox-title">
							<h5>
							<i class="fa fa-table"></i> 日志分析
						</h5>
							<div class="ibox-tools">
								<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
								</a>
								<a class="dropdown-toggle" data-toggle="dropdown" href="trans_info.html"> <i class="fa fa-wrench"></i>
								</a>
								<ul class="dropdown-menu dropdown-user">
									<li>
										<a href="trans_info.html">选项1</a>
									</li>
									<li>
										<a href="trans_info.html">选项2</a>
									</li>
								</ul>

							</div>
						</div>
						<div class="ibox-content" style="height: 600px;">
							<iframe id="ifr" src="" width="100%" height="100%"></iframe>
						</div>
					</div>
				</div>
			</div>

		</div>
		</div>

		<!-- 全局js -->
		<script src="../js/jquery.min.js?v=2.1.4"></script>
		<script src="../js/bootstrap.min.js?v=3.3.6"></script>

		<!-- 自定义js -->
		<script src="../js/content.js?v=1.0.0"></script>
		<script src="../js/mine/format.js"></script>

		<!-- 时间框 -->
		<script src="../js/mine/time.js"></script>

		<!-- treeview js -->
		<script src="../js/plugins/treeview/bootstrap-treeview.js"></script>
		<script src="../js/plugins/echarts/echarts-all.js"></script>
		<script src="../js/jquery.i18n.properties-min-1.0.9.js"></script>

		<!-- Page-Level Scripts -->
		<script>
		
		
			var traceIdTemp = escape(GetEscapeStr('traceId'));
			
//			var preUrl = "http://localhost:8041";
//			var preUrl = "http://10.145.196.107:8041";
			var preUrl = getUrl();
			
			
			function  getUrl(){  
				var url = "";
			    jQuery.i18n.properties({// 加载properties文件  
			    name:'ipAndPort', // properties文件名称  
			    path:'../properties/', // properties文件路径  
			    mode:'map', // 用 Map 的方式使用资源文件中的值  
			    callback: function() {// 加载成功后设置显示内容  
//			       //其中isp_index为properties文件中需要查找到的数据的key值  
			    	url = $.i18n.prop("url");
			    	
			    	
			    }
			    });
			    
			   
			    return url;
			} 
			

			var paramItem = {
				"name": name,
				"password": "d033e22ae348aeb5660fc2140aec35850c4da997",
				"title": "日志分析",
				"url": 'http://10.145.129.2:9030/logv1/index?platform=msc&startTime=2018-01-18&endTime=2018-05-18 12:12:12&searchIndex="' + traceIdTemp + '" AND ' + GetEscapeStr("agentId") + ' AND ' + GetEscapeStr("spanId") + '&selctedLogType=all,error,error,mid,error,mid,counter,timer,gauge'
			};
			window.onload = function() {

				var ifr = document.querySelector('#ifr');
				ifr.contentWindow.postMessage({
					paramItem: paramItem
				}, '*');
			}
			if(traceIdTemp != null && GetEscapeStr("agentId") != null && GetEscapeStr("spanId") != null) {

				$("#ifr").attr('src', 'http://10.145.129.2:9030/logv1/index?platform=msc&startTime=2018-01-18&endTime=2018-05-18 12:12:12&searchIndex="' + traceIdTemp + '" AND ' + GetEscapeStr("agentId") + ' AND ' + GetEscapeStr("spanId") + '&selctedLogType=all,error,error,mid,error,mid,counter,timer,gauge');
			}

			function getImg(code) {
				if(code == "1210") {
					return 'image://../image/SPRING_BOOT2.png';
				} else if(code == "2") {
					return 'image://../image/USER2.png';
				} else if(code == "2101") {
					return 'image://../image/MYSQL2.png';
				} else if(code == "8200") {
					return 'image://../image/REDIS2.png';
				} else {
					return 'image://../image/UNKNOWN_GROUP2.png';
				}
			}
			$(document).ready(function() {

								$.get(preUrl + "/transactionInfoDetail2", {
//				$.get("http://localhost:8041/transactionInfoDetail", {
						traceId: GetEscapeStr("traceId"),
						focusTimestamp: GetEscapeStr("focusTimestamp"),
						agentId: GetEscapeStr("agentId"),
						spanId: GetEscapeStr("spanId"),
						mRpc: GetEscapeStr("mRpc")
					},
					function(rs) {

						var data = JSON.parse(rs);

						var tree = JSON.stringify(data.rsList);
//						console.log(tree);
						$('#trans_detail').treeview({
							levels: 99,
							expandIcon: 'glyphicon glyphicon-chevron-right',
							collapseIcon: 'glyphicon glyphicon-chevron-down',
							nodeIcon: null,
							showTags: true,
							showBorder: true,
							data: tree
						});

						

					});

			});
		</script>

	</body>

</html>